import request from '@/plugins/axios'
import requestNLVideo from '@/plugins/axios/video'

/** save User */
// TODO: Need ReFacotr
export function saveVideo(params) {
  return request({
    url: 'api/video/save',
    method: 'post',
    data: params
  })
}

export function getVideo(projectId) {
  return request({
    url: 'api/video/findByProject/' + projectId,
    method: 'get'
  })
}
export function deleteVideo(id) {
  return request({
    url: 'api/video/delete/' + id,
    method: 'delete'
  })
}

export function deleteVideoList(params) {
  return request({
    url: 'api/video/delete/all',
    method: 'post',
    data: params
  })
}

// -----------  能力视频相关 api  -----------

// 生成 能力视频appkey
export function getVideoNLSign(params) {
  return request({
    url: 'api/aep/sign',
    method: 'post',
    data: params
  })
}

export function NLVideoCall(params) {
  return request({
    url: 'api/aep/call',
    method: 'post',
    data: params
  })
}

// 能力智慧视频
export function getNLDevice(params) {
  return requestNLVideo({
    url: 'api/dict/device/select?appkey=5910240001',
    method: 'post',
    data: params
  })
}

// 能力预览
export function mediaLive(params) {
  return requestNLVideo({
    url: 'api/dict/media/live?appkey=5910240001',
    method: 'post',
    data: params
  })
}

// 能力 云台方向控制 /device/ctrl/ptz
export function ctrlChangePtz(params) {
  return requestNLVideo({
    url: 'api/dict/device/ctrl/ptz?appkey=5910240001',
    method: 'post',
    data: params
  })
}

// 能力 聚焦控制 /device/ctrl/zoom
export function ctrlChangeZoom(params) {
  return requestNLVideo({
    url: 'api/dict/device/ctrl/zoom?appkey=5910240001',
    method: 'post',
    data: params
  })
}

// 能力 光圈控制 /device/ctrl/aperture
export function ctrlChangeAperture(params) {
  return requestNLVideo({
    url: 'api/dict/device/ctrl/aperture?appkey=5910240001',
    method: 'post',
    data: params
  })
}

// 能力 存储空间信息查询 /space/status
export function getSpaceStatus(params) {
  return requestNLVideo({
    url: 'api/dict/space/status?appkey=5910240001',
    method: 'post',
    data: params
  })
}

// 能力 云端录像查询 /storage/find/videorecord
export function getVideorecord(params) {
  return requestNLVideo({
    url: 'api/dict/storage/find/videorecord?appkey=5910240001',
    method: 'post',
    data: params
  })
}

// ----------------------------------------
// 保存视频到我们系统
export function saveNyVideo(params) {
  return request({
    url: 'api/video/ny/video/save',
    method: 'post',
    data: params
  })
}

// 我们系统保存的能力视频  api/video/findByProjectAndType/{projectId}/NY
export function findByProjectAndType(projectId) {
  return request({
    url: 'api/video/findByProjectAndType/' + projectId + '/NY',
    method: 'get'
  })
}

// 地图 企业下所有视频  api/video/findByTenantIdAndType/NY
export function findByTenantIdAndType() {
  return request({
    url: 'api/video/findByTenantIdAndType/NY',
    method: 'get'
  })
}
